'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { STRING, BOOLEAN, INTEGER } = Sequelize;
    await queryInterface.createTable("sys_menu", {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment: "主键id，自增",
      },
      parentId: {
        type: INTEGER,
        defaultValue: 0,
        comment: "父菜单ID 一级菜单为0",
      },
      perm: {
        type: STRING(50),
        allowNull: false,
        unique: true,
        comment: "权限值",
      },
      title: {
        type: STRING(50),
        allowNull: false,
        comment: "菜单名称",
      },
      name: {
        type: STRING(50),
        comment: "路由名称",
      },
      path: {
        type: STRING(50),
        comment: "路由路径",
      },
      component: {
        type: STRING(100),
        comment: "组件",
      },
      icon: {
        type: STRING(100),
        comment: "图标",
      },
      type: {
        type: INTEGER,
        defaultValue: 0,
        comment: '菜单类型  0目录 1菜单  2按钮 3外部链接'
      },
      status: {
        type: BOOLEAN,
        defaultValue: true,
        comment: "状态 true：有效  false：冻结",
      },
      sort: {
        type: INTEGER,
        comment: '排序'
      },

    })
  },

  down: async (queryInterface) => {
    await queryInterface.dropTable("sys_menu");
  },
};
